From f8e6e272a7b724079e3a660e009dfb20a30d5c4b Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 10 May 2012 10:25:33 -0400 Subject: [PATCH] styleproperty: make background-clip and background-area array properties Right now just make them arrays, but don't consider values after the first. --- gtk/gtkcssstylepropertyimpl.c | 14 ++++++++++---- gtk/gtkthemingbackground.c | 8 ++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index 0a642f0065..cde6ee5117 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -412,8 +412,7 @@ assign_border_style (GtkCssStyleProperty *property, } static GtkCssValue * -parse_css_area (GtkCssStyleProperty *property, - GtkCssParser *parser) +parse_css_area_one (GtkCssParser *parser) { GtkCssValue *value = _gtk_css_area_value_try_parse (parser); @@ -423,6 +422,13 @@ parse_css_area (GtkCssStyleProperty *property, return value; } +static GtkCssValue * +parse_css_area (GtkCssStyleProperty *property, + GtkCssParser *parser) +{ + return _gtk_css_array_value_parse (parser, parse_css_area_one, FALSE); +} + static GtkCssValue * bindings_value_parse_one (GtkCssParser *parser) { @@ -1253,7 +1259,7 @@ _gtk_css_style_property_init_properties (void) NULL, NULL, NULL, - _gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX)); + _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX))); gtk_css_style_property_register ("background-origin", GTK_CSS_PROPERTY_BACKGROUND_ORIGIN, G_TYPE_NONE, @@ -1263,7 +1269,7 @@ _gtk_css_style_property_init_properties (void) NULL, NULL, NULL, - _gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX)); + _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX))); gtk_css_style_property_register ("background-size", GTK_CSS_PROPERTY_BACKGROUND_SIZE, G_TYPE_NONE, diff --git a/gtk/gtkthemingbackground.c b/gtk/gtkthemingbackground.c index 158ac32f7e..4c7e44bbfc 100644 --- a/gtk/gtkthemingbackground.c +++ b/gtk/gtkthemingbackground.c @@ -57,10 +57,9 @@ _gtk_theming_background_apply_window_background (GtkThemingBackground *bg, static void _gtk_theming_background_apply_origin (GtkThemingBackground *bg) { - GtkCssArea origin; cairo_rectangle_t image_rect; - - origin = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN)); + GtkCssValue *value = _gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN); + GtkCssArea origin = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (value, 0)); /* The default size of the background image depends on the background-origin value as this affects the top left @@ -95,7 +94,8 @@ _gtk_theming_background_apply_origin (GtkThemingBackground *bg) static void _gtk_theming_background_apply_clip (GtkThemingBackground *bg) { - GtkCssArea clip = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP)); + GtkCssValue *value = _gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP); + GtkCssArea clip = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (value, 0)); if (clip == GTK_CSS_AREA_PADDING_BOX) { -- 2.30.2